//电影管理

var express = require('express');
var router = express.Router();
var sqlQuery = require('../../../module/sql');

router.get('/', async(req, res, next)=> {
    let did = req.query.id
    let sqlStr = 'select * from nav where id = ?';
    let result = await sqlQuery(sqlStr,[did])
    let nav =  result[0]
    let options = {nav}
    res.render('admin/nav/navedit',options)
    
  });
  
  
  router.post('/', async(req, res)=>{
    let navName = req.body.navName
    let did = req.body.did
    let sqlStr1 = "update nav set navName=? where id = ?"
    let arr = [navName,did]
    await sqlQuery(sqlStr1,arr)
    res.json({
      state:"ok",
      content:"导航信息更新成功"
    })
  
  })
module.exports = router;
